<?php
/**
 * Created by PhpStorm.
 * User: dell1
 * Date: 2016/9/28
 * Time: 18:26
 */
/*$line =1;
while($line<=5){
    $empty_pos=$star_pos=1;
    $empty=5-$line;
    $star=2*$line-1;
    while($empty_pos<=$empty){
        echo '&nbsp;';
        ++$empty_pos;
    }
    while($star_pos<=$star){
        echo "*";
        ++$star_pos;
    }
    echo '<br>';
    ++$line;
}*/
$n=5; //金字塔行数
for($i=1;$i<=$n;$i++){
    //在打印*之前，先打印空格
    for($k=1;$k<=$n-$i;$k++){
        echo"&ensp;";
    }
    //内层控制每层*的个数
    for($j=1;$j<=2*$i-1;$j++){
        echo"*";
    }
    echo"<br/>";
}
?>